From: Markus K. <mar...@bs...> - 2011-08-08 09:00:44
|
hi joe, after defining a range index on that attribute it performed faster. my collection.xconf didnt seem to be the problem. I just wasnt sure how to set up the index on attributes with lucene (is there an example that I missed?) and then query it correctly. but will probably give this another try sometime in the near future and then get back to you. for now it works and performs pretty fast with the range index, anyway :-) thanks for your help and the tips... cheers, markus >>> Joe Wicentowski <jo...@gm...> 5.8.2011 18:22 >>> Hi Markus, > thanks for your answer. Maybe picking @xml:id was a bad example :-) I was aware of the automatic operation eXist already performs: just wanted to take it as an example, but actually query any attribute, e.g. @corresp or @type. > > I also dont really need the fulltext features offered by Lucene, a simple equal-comparison would be enough for now. Ah, I see. I would recommend applying xs:string range indexes on these attributes. For example: <create qname="@corresp" type="xs:string"/> This will allow fast queries like: //tei:term[@corresp eq $x] Be sure you've configured the index correctly - see http://exist-db.org/indexing.html#d84e967. The structure of this collection.xconf file is very important to get right. Also, be sure you've saved the collection.xconf file in the correct location. Lastly, be sure you reindex after updating your collection.xconf. > Plus, I tried a lucene query that looked exactly like yours but it wouldnt return any results. Maybe there is something wrong with my index definition in collection.xconf?! I also read that there is another option to query attributes when something like <create qname="@…" type="xs:string"/> has been defined. Do I just query that in the usual way? For a lucene query to work, you would have had to apply a lucene index correctly (see link in my previous paragraph) and reindex. Did you? If so and if your query still didn't work, let us know your eXist version number. Note that you can check yourself to confirm if your query used an index or not by going to your admin page (http://localhost:8080/exist/admin), selecting the "Query Profiling" pane, clicking on "Enable Tracing", and checking the "Indexes" tab after running your query. Joe |