Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #41 (permalink)  
Old October 23rd, 2007, 04:33 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jimi, give a favor please:

Insert some post or article with the word "olá"

Then try to search this same word "olá" under your search engine.

Didi you get the post/article result from the search?

I made my ForumsSearchEngine...
But the posts/articles are encoded with fckeditor.
When I write some text on my SearchTextBox I make the "htmlenconde(textbox.text)" But I think the encode isn't the same.

For example, in DB I have +/- "ol&uccte;"
And my encoded.textbox return "ol#225;"

Thanks,
Max

  #42 (permalink)  
Old October 23rd, 2007, 04:59 PM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PLEASE DELETE.
  #43 (permalink)  
Old October 24th, 2007, 03:20 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Quote:
quote:Originally posted by Maxxim
 Jimi, give a favor please:

Insert some post or article with the word "olá"

Then try to search this same word "olá" under your search engine.

Didi you get the post/article result from the search?

I made my ForumsSearchEngine...
But the posts/articles are encoded with fckeditor.
When I write some text on my SearchTextBox I make the "htmlenconde(textbox.text)" But I think the encode isn't the same.

For example, in DB I have +/- "ol&uccte;"
And my encoded.textbox return "ol#225;"

Thanks,
Max

max, i think it's probably something to do with the Regex expression filter that i've used in the RemoveNonAsciiFromString method. i'll try to dig into it a bit more. perhaps you could look into that area too and see if you can find a tweak there that can be used.

i'll update if/when i find anything.

jimi

http://www.originaltalent.com
  #44 (permalink)  
Old October 24th, 2007, 06:18 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

max,

found the issue. replace the RemoveNonAsciiFromString method with the one below below:

        protected static string RemoveNonAsciiFromString(string content)
        {
            // this may cause issues with other regional languages
            // caveat emptor. could be replaced in those situations
            // with something to suit the language in question
            //content = Regex.Replace(content, "[^A-Za-z0-9 ]", "").Trim();
            //content = Regex.Replace(content, "\\s+|\\s+$", " ").Trim();
            // UPDATE, this new line below omits characters other than letters or numbers
            // therefore will work with words such as olá etc... (thanks max ;))
            content = Regex.Replace(content, @"[^\p{L}\p{N} ]", string.Empty).Trim();
            return content;
        }

jimi

http://www.originaltalent.com
  #45 (permalink)  
Old October 24th, 2007, 07:01 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello jimi!

I didn't used your code.
I made my own searchEngie only for forums, because I don't use sql index.

But in my script, I'm having problems with special characters... I think is because the charset...

Could you please test your searchengine and write one post or article with the word "olá" and then search for this word ?

this word will be saved on db as "ol&accute;"

But my textBox wil search for "ol#225;" (or something like this!

I think the charset used by fckeditor is utf-8. I tried to change the charset of template-master to utf-8 but I still have decode.(textbox.text) = "ol#225;"

But, please try it yourself.

  #46 (permalink)  
Old January 30th, 2008, 11:38 AM
Authorized User
 
Join Date: Oct 2007
Location: Arlington, VA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Jimi,

Thank you for creating the Search module and I am using it. However, I hope you can help me giving me some tips to modify your module to fit my application.

My application has different level users to use, so A member should not see any article is for Admin only. What can I do to call the "cn" by Search_all_forManagement instead of Search_all in SqlSearchProvider.cs.

PLEASE HELP...


jophie
  #47 (permalink)  
Old January 30th, 2008, 01:29 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Quote:
quote:Originally posted by Jophie
 Hi Jimi,

Thank you for creating the Search module and I am using it. However, I hope you can help me giving me some tips to modify your module to fit my application.

My application has different level users to use, so A member should not see any article is for Admin only. What can I do to call the "cn" by Search_all_forManagement instead of Search_all in SqlSearchProvider.cs.

PLEASE HELP...


jophie
jophie,

you'd need to create the procedures Search_all_forManagement in an identical way throughout the project as for Search_all. that means, you'd have new stuff in:

DAL/SqlClient/SqlSearchProvider.cs
DAL/SearchProvider.cs
BLL/SearchItem.cs

basically, just look for the search_all stuff and copy then rename, then change the sql to the filter that you require. basically, just works in an identical manner to the rest of the TBH framework.

let me know how you fare.

[edit] also, you must do the same with the saerch_all_count methods (i.e. create throughout, Search_all_forManagement_count methods.


jimi

http://www.originaltalent.com
  #48 (permalink)  
Old January 30th, 2008, 01:54 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

tho jophie - on reflection, you might be better to add a parameter to the search_all methods (bool isManagement) and in the final sql, act on the presence of that parameter (better still, make the parameter an enum, then you could have multiple scenarios).

anyway, just a thought as i was sitting on the loo :D

jimi

http://www.originaltalent.com
  #49 (permalink)  
Old January 30th, 2008, 04:06 PM
Authorized User
 
Join Date: Oct 2007
Location: Arlington, VA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Jimi,
Thank you for your quick reply.

I understand that I can create more store procedures "SearchAllforManagement", SearchAllCountforManagement", "SearchAllforStaff" and "SearchAllCountforStaff" in DB. BUT I don't understand how I can call them in C#.

the code:
"SqlCommand cmd = new SqlCommand("SearchAll", cn); " is insides Public override List<SearchItemEntity> GetSearchItem(string searchExpression, string searchMode, string uniqID, int startRowIndex, int maximumRows) {}

Should I need to duplicate Public List<SearchItemEntity> and call it like List<SearchItemEntity2>?? I am confused.

The Second problem:
I did try to put the following code in SqlSearchProvider.cs

Public override List<SearchItemEntity> GetSearchItem (...){
if User.IsInRole("Administrator") {
..
sqlCommand cmd = new Sqlcommand("SearchAll", cn);
..
} else if User.IsInRole("Management") (
..
sqlCommand cmd = new Sqlcommand("SearchAllforManagement", cn);
..
}

BUT the error message shows:
DAL.SqlClient.SqlSearchProvider does not contain a definition for 'User'.

Jimi, can you tell me how I can pass 'User' Object to SqlSearchProvider? or this way won't work.



jophie
  #50 (permalink)  
Old January 31st, 2008, 05:50 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

jophie,

looking at the stored proc (searchall), i can see a paramater that i didn't use being passed in (@uniqID). you could utilise this and from the client app assign a value to it (such as 'mgt', 'admn', 'private', 'public' etc, etc) and then in the stored proc, put a case statement on part of the where clause based on the value passed to @uniqID.

just a quick thought for a quick win.

jimi

http://www.originaltalent.com
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Announce: Site Generator V2 now available jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 56 October 2nd, 2009 01:06 PM
[Announce] Intellium For Web is released Intellium ASP.NET 1.0 and 1.1 Basics 0 April 3rd, 2008 03:23 AM
TBH Search Engine Optimization retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 5th, 2007 04:55 PM
Anyone created a search module? doanhvu BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 August 12th, 2007 12:19 AM
Search module vantoko BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 August 7th, 2007 07:48 AM



All times are GMT -4. The time now is 06:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.