Reputation: 11
how can I add to the CSE results also partial words? For example if I search for "out of reach" then it's fine. But "out of r" shows 0 results. And I don't want to use synonyms. It would mean thousands of synonyms which is not possible to implement. It must work with partial results by default somehow.
Can you give me some hints?
Thanks.
Upvotes: 0
Views: 664
Reputation: 1865
Turn autocomplete on to get it to suggest full terms for partial, fast and saves on spelling mistakes. You can add common mispellings as synonyms or autocomplete suggestions. You can add the autocomplete full terms manually or upload from a file. Autocomplete is in Edit search engine, Search features, Autocomplete tab.
Users searching with a wildcard, eg out of r*
is supported just as in normal google search, you could possibly add to the code so that returning no matches resubmits the query with wildcards at the end of each word, or you could amend what is typed into the input box to append wildcards to each work before searching. To do this you can upload a refinements file that does simple things like add wildcards to one-letter search times. Or you could create an extra input box for the user to type in (hiding the original), and use an EventListener or click event to capture whatever is typed in, pass it to your script and then pass onto the search engine.
Create an XML file of autocomplete terms using a script. Something as simple as using code - even an old fashioned spreadsheet macro- can be used to generate a bunch of nearly-identical lines each with a wildcard at the end. You could add autocomplete terms for all one or two character words (but may would be best to exclude very short words like a
, it
, do
from this list). The user will see wildcards when they type the inital letters in- but they would need to recognize and click on them - not much good it they don't know what r*
means.
A better approach with generating an XML file to upload for autocomplete would be to use google webmaster tools (or even a common-word finder tool) to analyze the top 100 words (or top 1000 words) in your website's text. Then create a short piece of code to transform this list into the XML, which you the upload. This won't get every partial match but will get the most common searched-for words in there quickly. It will cut down on misspellings too.
Upvotes: 1