views:

48

answers:

3

Hi

I have a problem that i want to search in the specific locations in the indexed text, let we have a lucene document that contains text as

<Cover>
This document contains following items 
1. Business overview.
2. Risk Factors.
3. Management 
</Cover>
<BusinessOverview>
our business is xyz
</BusinessOverview>
<RiskFactors>
we have xyz risk factors
</RiskFactors>
<Management>
we have xyz type of management
</Mangement>

now in above code html tags(could be any thing) divide main document in sections now i want to have a functionality if user give some text to search and does not mention any specific section the text should be searched in whole document but user if user specify some section along with text to search, the search should be done only in that particular section. I want to know is this type of search is possible with solr/lucene.

Regards Ahsan

A: 

Your schema should reflect that need ; the data sent to the indexer would have then to match this schema properly. Once done, you'll be able to query against scpcific fields.

You could also use an xml importer.

Guillaume Lebourgeois
schema wise i have to index section separately right? but my requirement is i have to group the results on the basis of main document.
Ahsan Iqbal
+1  A: 

You can use the <copyField> option to have a "field of fields"

se here:

http://wiki.apache.org/solr/FAQ#How_do_I_use_copyField_with_wildcards.3F

http://www.ibm.com/developerworks/java/library/j-solr1/

mamoo
A: 

I have never worked with solr but lucene itself has very flexible query language, see this link. So answer is yes it is possible.

Skarab
can u please give a sample query for that
Ahsan Iqbal