Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
931 views
in Technique[技术] by (71.8m points)

html - Strategies to Implement search on XML file

I have found some posts related to search on XML but those were not helpful for my task.

My task is to implement a search. Source: 5-6 XML files like People,Buildings,News etc (each category being an XML file I have 30000 Entries totally). User can select a category and type some keyword. The search phrase should search the XML file and return results are to presented on a html page. If user doesn't select a category all XML files should be searched.

Please tell me best strategy/Algorithm to implement this and best technology.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Transform your XML documents (using XSL) and upload them (HTTP post) to an instance of Solr. You'll then be able to perform a range of search operations on the indexed data.

The Solr Wiki is unavailable currently, but here's an example of it's support XML format:

<add>
  <doc>
    <field name="employeeId">05991</field>
    <field name="office">Bridgewater</field>
    <field name="skills">Perl</field>
    <field name="skills">Java</field>
  </doc>
  [<doc> ... </doc>[<doc> ... </doc>]]
</add>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...