I am using OpenSearchServer v1.2.4. I want to access OpenSearchServer database field like "autocomplete" or Spell check etc. How Can i do that? The OpenSearchServer api only provides title, meta, url fields and some others via XML. Please suggest me query/search pattern to get autocomplete field.
1 Answers
You can easily control the returned fields by editing the query. To do that, go to the query tab panel.
Spellchecking
To activate the spellcheck, edit the "search" query and go to the spellcheck tab panel. If you are using the web template, use the field "contentExact" or "titleExact". The spellcheck module will build a dictionary by extracting the words present in this field. There is three algorithms available: Levensthein, Jaro-Winkler, NGramDistance.
As soon as you have set up the spellcheck settings and saved the query, you will be able to use it using the XML over HTTP API. Most of the time, the XML will include spellcheck suggestions. You have to decide when you show the suggestion to the users. You may display the suggestions when the search returns no document.
Autocompletion
The role of the "autocomplete" field is to collect all the expressions available in the indexed documents (web pages).
Here is a common way to build an autocompletion feature:
- Create a new empty index with the following fields:
- Expression: indexed, stored, the analyzer describer in the next point.
- freq: indexed, not stored.
- Create a text analyzer for the expression field, with the following parameters:
- Tokenizer: StandardTokenizer
- In the filter list, add:
- a LowerCaseFilter
- a EgdeNGramFilter (Min gram size: 1 - Max gram size: 50 - Edge side: front)
- Create a sheduler job. It will populate the new index with the collected expressions at regular interval (Example: once a day). The typical task and parameters are:
- Add a "Delete query" task: Query::
- Add a "Pull terms" task:
- Source field name: autocomplete
- Index source: The name of the web index
- Term field name: expression
- Frequency field name: freq
- Minimum frequency: 1
- Frequency pad: 9
- Add an "Index - optimize" task.
- Create a new request with the following parameters:
- Pattern query: expression:($$)
- Returned field: expression
- Sorted fields: freq descending, score descending
- Integrate the autocompletion user interface by using the new query.

- 3,384
- 1
- 14
- 16
-
can you please suggest me some example query for spell check. And Should i start a new crawler for autocomplete terms? and What about already indexed autocomplete words? – Gopa Soft Apr 08 '12 at 11:07
-
should i create an empty index? for that? – Gopa Soft Apr 08 '12 at 11:31
-
1I have added more details. You may have a look at the OpenSearchServer free 30 days trial support. I think you need less than 30 days to succeed ! – Emmanuel Keller Apr 08 '12 at 18:47
-
An example of [scheduler job](http://tinypic.com/r/2njj2c4/5). An example of [analyzer](http://tinypic.com/r/33yom06/5) – Emmanuel Keller Apr 08 '12 at 19:33
-
Sorry! but it's not working. the query template returns 0 documents. – Gopa Soft Apr 08 '12 at 20:21
-
On some queries like "codeigniter" the query returns codeigniter. – Gopa Soft Apr 08 '12 at 20:24
-
Please answer my this question http://stackoverflow.com/questions/10070300/opensearchserver-why-am-i-getting-this-error-error-java-lang-nullpointerexcept – Gopa Soft Apr 09 '12 at 07:35