Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: seadhna on July 21, 2021, 18:46:13

Title: Possible to change search engine so it doesn't search for exact phrase?
Post by: seadhna on July 21, 2021, 18:46:13
Hi, I've just been searching forum about this idea and found this post from 2014: https://forum.elxis.org/index.php?topic=7896.msg52069#msg52069
but I couldn't find a response on it.

Is it possible to tweak the frontend search so that if you enter multiple words it is not treated as an exact phrase unless they are in quotes?
Title: Re: Possible to change search engine so it doesn't search for exact phrase?
Post by: datahell on July 21, 2021, 19:33:06
Elxis supports multiple search engines and you can develop your own ones too. A search engine is a type of Elxis extension and each one can work totally different from the others. So you can built your own search engine and make it work as you want (search anywhere, any style). Lately I developed a custom one, alternative to the standard "content" engine, for site e-nomothesia.gr (https://www.e-nomothesia.gr/search/) (in Greek sorry). The form at the top is a module, the actual form of the search engine is the one below. The form fields can be different, the database tables/files/remote systems to search different, the style of the results shown can be different, etc. You can customize anything.

So, to answer your question: Elxis has built-in a "content" search engine for general use. You can develop your own search engine and customize it as you want. And Yes, you can do what you ask.
Title: Re: Possible to change search engine so it doesn't search for exact phrase?
Post by: seadhna on July 23, 2021, 17:42:07
Thanks datahell, I'm trying to research how to do this - what's the term for when you don't want an exact phrase, but rather just for all the words to appear anywhere on the page?
Title: Re: Possible to change search engine so it doesn't search for exact phrase?
Post by: datahell on July 23, 2021, 21:54:32
I don't know the term however I don't find it a good option. For instance if I type as search term the phrase "the cat is hungry" the search will return results matching any of the words "the", "cat" "is" and "hungry". Do you see how many irrelevant results you will get? I believe there must be a kind of filter, for instance exclude common words like "the", "is", "in", etc, exclude small words (eg less than 4 characters), etc. An the other hand some of the excluded words might be important for some terms, for instance "in charge". You also need a very special ordering system, for instance place first the results with exact match and order the rest by the number of words matched and their occurrence. The search becomes too complex. I believe this kind of search can be realized only for specific sites and you need a very special indexing in database (a new db table I believe). The search will be performed on the indexing table instead like big search engines do (google for example).
Title: Re: Possible to change search engine so it doesn't search for exact phrase?
Post by: seadhna on July 28, 2021, 14:33:19
Oh, so you don't think it's possible? Yes, I understand your point about small words (although I think it would be useful to search three-letter acronyms which many organisations use) e.g. FAO (Food and Agriculture Organization), which is currently not possible. An example of when it would be very useful to search for articles which must contain both words but the words don't have to appear together: there are many articles on a site regarding the airplane crash MH17 but many of the articles are regarding Malaysia and many are regarding Ukraine - to only see the articles which refer to Ukraine, it would be useful to be able to search MH17 ukraine but of course not as an exact phrase.