Developer forum

Forum » Development » How to get the same resultset from Lucene as DW default searching

How to get the same resultset from Lucene as DW default searching

Allan Iversen
Reply

I've got an question regarding how to do correct (or better) manual search with the search index.


Right now I just search with following code:


SearchQuery q = new SearchQuery();
q.Add(new Dynamicweb.Searching.Queries.Criterias.Criteria("sys_summary", searchText));
SearchResult result = Dynamicweb.Searching.IndexManager.Current.QueryIndex ("Products", q);


It works OK, but because the creation datetime (and more field) for a product  is included in the sys_summary field in the Lucene index, converted as eg. P00000000235063. Because of this, it is possible to get wrong hits for a search for eg. productnumber 235063.


How do you DW developer do the searching . I would like to imitate the real thing, but I am not able to get the exact same resultset back. I have tried to add different criterias, but the result is not always the same as the default way.


Is there a way to get search results back in the same way as the default module searching programmatic?


- Allan


Replies

 
Anders Ebdrup
Reply

Hi Allan,

 

First of all I am not a DW developer, but I have been using the lucene index a lot.

 

I do not like the "sys_summary" field as it contains disturbing information which does not belong to the summary, and I usually build my own search query for the lucene index to get the desired result.

 

Maybe you can try to use the index entry "surrogat" and see if it is possible to clean up the summary field - http://volpav.wordpress.com/2013/06/12/adding-additional-fields-to-the-index/. That seems to a good solution for you if you only what to remove some information from the index field

 

Best regards, Andesr

 

 

You must be logged in to post in the forum