lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abin Mathew <abin.mat...@toostep.com>
Subject Re: Newbie Question on Custom Query Generation
Date Sat, 30 Jan 2010 05:43:51 GMT
Hi, I realized the power of Dismax Query Handler recently and now I
dont need to generate my own query since Dismax is giving better
results.Thanks a lot

2010/1/29 Wangsheng Mei <hairroot@gmail.com>:
> What's the point of generating your own query?
> Are you sure that solr query syntax cannot satisfy your need?
>
> 2010/1/29 Abin Mathew <abin.mathew@toostep.com>
>
>> Hi I want to generate my own customized query from the input string entered
>> by the user. It should look something like this
>>
>> *Search field : Microsoft*
>> *
>> Generated Query*  :
>> description:microsoft +((tags:microsoft^1.5 title:microsoft^3.0
>> role:microsoft requi
>> rement:microsoft company:microsoft city:microsoft)^5.0) tags:microsoft^2.0
>> title:microsoft^3.5 functionalArea:microsoft
>>
>> *The lucene code we used is like this*
>> BooleanQuery must = new BooleanQuery();
>>
>> addToBooleanQuery(must, "tags", inputData, synonymAnalyzer, 1.5f);
>> addToBooleanQuery(must, "title", inputData, synonymAnalyzer);
>> addToBooleanQuery(must, "role", inputData, synonymAnalyzer);
>> addToBooleanQuery(query, "description", inputData, synonymAnalyzer);
>> addToBooleanQuery(must, "requirement", inputData, synonymAnalyzer);
>> addToBooleanQuery(must, "company", inputData, standardAnalyzer);
>> addToBooleanQuery(must, "city", inputData, standardAnalyzer);
>> must.setBoost(5.0f);
>> query.add(must, Occur.MUST);
>> addToBooleanQuery(query, "tags", includeAll, synonymAnalyzer, 2.0f);
>> addToBooleanQuery(query, "title", includeAll, synonymAnalyzer, 3.5f);
>> addToBooleanQuery(query, "functionalArea", inputData, synonymAnalyzer,);
>> *
>> In Simple english*
>> addToBooleanQuery will add the particular field to the query after
>> analysing
>> using the analyser mentioned and setting a boost as specified
>> So there "MUST" be a keyword match with any of the fields
>> tags,title,role,description,requirement,company,city and it "SHOULD" occur
>> in the fields tags,title and functionalArea.
>>
>> Hope you have got an idea of my requirement. I am not asking anyone to do
>> it
>> for me. Please let me know where can i start and give me some useful tips
>> to
>> move ahead with this. I believe that it has to do with modifying the XML
>> configuration file and setting the parameters in Dismax handler. But I am
>> still not sure. Please help
>>
>> Thanks & Regards
>> Abin Mathew
>>
>
>
>
> --
> 梅旺生
>

Mime
View raw message