Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-11-13 18:12:53

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: More advanced, or just smart search

OK. I now it’s still “alpha” so I expect to find the odd problem here and there. Let us know when you have an updated version so we can test it out further.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#14 2005-11-13 18:24:12

Henrik Pejer
Member
From: Sweden
Registered: 2005-10-13
Posts: 23

Re: More advanced, or just smart search

My thought is that people that have a large txp-site may try this kind of search out so that I know that it works before I start making a proper plugin.

And I’ll let you know if the development of this plugin continues or not. I guess that I’ll have to wait for Andrew to give me some feedback on this.

Thanks for trying it out, Stuart!

But please Stuart tell me this: what version of txp are you running? And do you know what version of MySQL you have?

Once again, thanks Stuart!

Last edited by Henrik Pejer (2005-11-13 18:27:43)


.:8):.

Offline

#15 2005-11-13 18:40:08

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: More advanced, or just smart search

I’m on TXP 4.0.2 and will generally be on the latest revision via SVN. MySQL is 4.0.18 though I think that might be updated soon as they have just upgraded phpMyAdmin. I shall probably move this over to thebombsite as it isn’t breaking anything on the test site. thebombsite is a hell of a lot bigger so I can try out the different search types and see what they can do.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#16 2005-11-13 18:43:37

Henrik Pejer
Member
From: Sweden
Registered: 2005-10-13
Posts: 23

Re: More advanced, or just smart search

I can’t thank you enough Stuart!

With all your help my first plugin might just be working out ok ;)

Take care and good night!


.:8):.

Offline

#17 2005-11-13 20:35:00

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: More advanced, or just smart search

No problem. One question I might ask though. Can it, or will it, be able to search for phrases enclosed in quotes, in a similar way to Google search, looking for instances of the complete phrase rather than the individual words?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#18 2005-11-13 21:21:44

Henrik Pejer
Member
From: Sweden
Registered: 2005-10-13
Posts: 23

Re: More advanced, or just smart search

I believe that if you use "" it should work right now. Please feel free to test it! But remember that if you use expansion for you search type you will get hits that might not contain that particular sentence. The search will be case insensitive ofcourse.

If you or anyone else feel a need for a more complicated search like with AND’s and OR’s that’ll be no problem: I’ve done a search engine for one of our clients that uses parenthesis, AND, OR and NOT aswell. So you could search for:

textpattern AND (dean OR allen) AND NOT ("moveable type" OR "word press")

Which will give you results that have textpattern AND dean OR allen but NOT moveable type NOR word press in the article.

Ofcourse you can nest the parenthesis so there is no limit there. The only limit, i guess, is the max of 255 characters in the searchstring but that is a small price to pay…

If such an advanced search engine is what is wanted, I could modify that search code to suit the TXP-database.

Since my job is to deal with PHP and MySQL this is exactly my neck of the woods…

Take care and happy TXP-ing!

Last edited by Henrik Pejer (2005-11-13 21:31:58)


.:8):.

Offline

#19 2005-11-14 00:23:22

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: More advanced, or just smart search

Good. I have moved it into thebombsite.com now and have done a couple of minor modifications to get XHTML 1.0 Strict validation. Here’s what I have now:-

<code>
function sm_search_field($atts){ global $prefs; extract(SM_load_config()); $val=(sm_search_words()); $atts[‘label’]=isset($atts[‘label’]) &&trim($atts[‘label’])!=”“?$atts[‘label’]:“Search”; //print_r($prefs); $action=‘http://’.str_replace(“[/{1,}]”,”/”,$prefs[‘siteurl’].’/’.$searchsection); return <<<EOF
<form action=”/search/” method=“get”>
<p><input type=“text” name=“qq” id=“qq” value=”{$val}” />
<input type=“submit” value=”{$atts[‘label’]}” /></p>
</form>
EOF;
}</code>
<br />

Note how “form” now has an “action”. Basically this needs to be the section you have set for the search facility in the “searchsection” attribute. I have hard-coded /search/ into it but this needs to be picked up from the tag and I don’t know PHP well enough to sort this properly.

Note I have also surrounded the 2 “input types” with “p” tags. I think this really requires a wraptag attribute as others may want some other type of block element.

But it works for ME and validates. :)

Last edited by thebombsite (2005-11-14 00:23:58)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#20 2005-11-14 07:05:01

Henrik Pejer
Member
From: Sweden
Registered: 2005-10-13
Posts: 23

Re: More advanced, or just smart search

Great Stuart.

I was aware of this aswell (turns out there are a few issues I had forgotten to state, sorry) and yes the whole idea with the searchsection is to put it into the action of the form so that you could put that searchform on all pages, if that is what you want.

Thanks for putting it ‘live’ on your site, great for testing. I thought you might just ‘hide’ it by putting it in like /betasearch and not tell anyone ;)

I guess I have to start making a propper plugin that:

1. shows search_result_excerpt (funny for that works for me, perhaps I need to test the 4.0.2 version of txp)
2. make sure the form works

Take care and keep txp-ing


.:8):.

Offline

#21 2005-11-14 16:52:57

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: More advanced, or just smart search

Now what’s the point of just me testing it? I know where everything is. :grin:


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#22 2005-11-14 21:23:49

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: More advanced, or just smart search

thebombsite wrote:

Now what’s the point of just me testing it?

Okay, want some feedback? When I go to your search page, there already is this message:

Search result

Your search for “” gave 0 hits.

Showing hit: 1 – 0

which I think shouldn’t be there (eventually).

Then I searched for english australian iranian. 12 hits, of which the first one probably the only article with all three words in it. The others I assume only have one or two of them (I did not read them all…). But I tried one of the results, your links page, read it about five times, but I did not see any of the three search words there. The closest was ‘Australia’.
But as you know Stuart, I’ve got this issue with seeing things and yellow, so I could of course be wrong ;)

EDIT: The Google toolbar helped me out, I’m afraid it was this issue again :(
Great search tool BTW, I’m looking forward to the plugin release!

Last edited by doggiez (2005-11-14 21:27:49)

Offline

#23 2005-11-14 21:42:34

Henrik Pejer
Member
From: Sweden
Registered: 2005-10-13
Posts: 23

Re: More advanced, or just smart search

Hi doggiez,

great that you’r testing.

I’m aware of the fact that it says ‘your search for …’ but I thougt that I would fix all those things if the search get OKed. The search, the query to the database, is the simple thing and therefore as soon as that algorithm gets OKed I’ll make a proper plugin.

The reason for the extra results is this: the plugin gives a few options to the admin (perhaps user should have these options aswell?) of the txp-site. He can choose from 3 different search modes:

1. Only show hits that seem relevant. This means that even though an article contains the word you search for, MySQL (the database) scores it as not relevant. This is an algorithm that MySQL uses and I’m not able to change it.

2. Show all hits that contain the word/words that you search for. This will show all hits.

3. A special kind of search that first searches for the words you supplied and then searches a second time using the most relevant results from the first search. This search will give you the most number of hits, and also hits that could be irrelevant.

There is also an option to sort the hits depending on the order of the search words.

I thought that I would give the site-admin this choice so that we could test the search, see if the different searchmethods are usable or not, and where to go next.

The reason I didn’t test this myself is that I have no control over a txp-site with lots of content where these kinds of searches really can show what they are made of.

So, basicly, the questions that are interesting to me are:

1. Is the search slow?
2. Does it give a correct result, depending on the search type that is used?

So you admins that wanna help can first use the normal search and see how many, and which, articles you get hits on.

Then you can switch to boolean and see if you get the correct result also (probably more than before). Also, when using boolean, try the priority search.

And at last test with expansion. Does the ‘extra’ hits seem ok? Or are they just ‘noise’?

I know that I’m asking a lot from (probably very) busy admins but if I could do these test with a database that contains more than 3 articles, I would!

I’m very sorry that the search_result_excerpt does not work for Stuart. Unfortunatly I can only say: it works for the 2 different sites that I can test this on, which isn’t much of a comfort for anyone.

Thanks again for all your patiens.

Take care and happy txp-ing!


.:8):.

Offline

#24 2005-11-14 22:18:21

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: More advanced, or just smart search

Okay, I installed it on my site. I don’t have much time tonight, but a few things I noticed:

1. ‘Expansion’ always gives me this: 1 hit, showing results 1-0, and not showing any results, no matter if the search word(s) occur(s) in 100 articles or in none.

2. It’s also finding articles in sections that I’ve set not to include in the search.

3. So far, I don’t see any difference between ‘boolean’ and ‘normal’ (except for the order in which the results appear), and prioritysearch ‘true’ or ‘false’.

4. search_result_excerpt doesn’t work for me either.

Last edited by doggiez (2005-11-14 22:19:15)

Offline

Board footer

Powered by FluxBB