Have a look at http://wiki.apache.org/solr/DataImportHandler#XPathEntityProcessor

It might be just what you need?

-Mike

On 7/14/2011 3:31 AM, Lucas Miguez wrote:
Hi,

yes, I was asking about it, is it possible to index an XML file?

Is it possible to know which node of the XML the search result comes from?

So I have 2 XML files, the original and the summary. I want to index
the summary. So, that is an example of the summary XML:

<Objetives>
       <Activity xpath="2_3">
         <TitleP>A.</TitleP>
         <TextP>Requisitos generales mínimos exigibles a las
explotaciones para las que se soliciten
las ayudas.</TextP>
         <Part>
           <TitlePart>7. Además, la actividad de la explotación deberá
garantizar:
</TitlePart>
           <gSubPart>
             <SubPart>
               <TextSubPart>a) Gestión de los medios de 
producción.</TextSubPart>
             </SubPart>
             <SubPart>
               <TextSubPart>b) Conservación de elementos propios de la
zona y en consonancia con el medio.</TextSubPart>
             </SubPart>
           </gSubPart>
         </Part>
       </Activity>
</Objectives>

That is an summary of my original XML file. So, the xpath atribute in
Activity Element shows me the way to retrieve the information in the
original file (2_3 : 2 is the second element in PartV, and 3 is the
third Part inside the second PartV).
So, I need to index the fields (TitleP, TextP, TitlePart, TextPart,
TextSubPart. This fields can occur zero or more times), and I want to
know the xpath to the original file for each field, because I need to
show to the user the hierarchy of the results. Following the XML
example: Imagine that the user search the word "zona", then I have to
show the TitleP, the TextP, the TitlePart, the TextPart and all the
TextSubPart that are childs of gSubPart.

Is there any example similar to my issue?

Thanks!



2011/7/13 Gora Mohanty<g...@mimirtech.com>:
On Wed, Jul 13, 2011 at 10:30 PM, Lucas Miguez<lucas.mig...@gmail.com>  wrote:
Hi,

is it possible to do that in Apache Solr? If i make a search, how I
know from where it comes the result?
[...]

Your question is not very clear, and I happen unfortunately to be
out of crystal balls and Tarot cards.

Is it possible to do what? Make a search on what, and what sort
of results do you you expect from said search?

Peering into the misty depths of my non-existent crystal ball,
if you are asking is it possible to index an XML file, search it,
and figure out which node of the XML the search result comes
from, yes that is possible; though details, and better advice
would require more input from your side. Roughly speaking,
each node can go into a separate Solr field, and full-text
search on all relevant fields is also possible. Joking aside, please
do provide more details.

Regards,
Gora


Reply via email to