You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by matt ma <ma...@yahoo.com> on 2003/11/05 21:02:50 UTC

xpath with index after data is added does not work

hello,

Indexes don't seem to pick up new data.  
After I index some data in a collection and then add
new data, xpath returns nothing for the new data.

For instance
if I index
xindice add_indexer -c /db/usr -n tmp -p tmp@id

and then i add some data

<tmp id="5">...

then 
xindice xpath -c /db/usr -q /tmp[@id=5]

returns nothing until I delete the index and then
re-create it.  

Is this by design that indexes do not automatically
update?  Is there any another solution to this beyond
deleting and recreating all indexes after new data is
inserted?

thanks


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

Re: xpath with index after data is added does not work

Posted by Terry Rosenbaum <Te...@amicas.com>.
Andrew White wrote:

> element@id doesn't.  See my comments on bug 21055.


You could be correct about indexing not working after
shutdown/restart. The unit tests do not address
that situation.

I do know from unit tests (both those now integrated and
those not yet integrated but attached to bug 23595) that
indexing (including element@attr) does work in the
unit test situation. The IndexedSearchTest attached to 23595
performs various queries both with and without indexes
and compares the run times to determine whether or
not indexing is assisting performance.

Also, indexing (I use element@attr patterns) works fine in my 
applications BUT my applications
use Xindice in embedded mode as a "temporary" database. The Xindice
database and indices are created fresh each time the applications
start.

Perhaps you can devise a unit test demonstrating the problem
and contribute it to the project?

I don't think that rebooting the computer is necessary for this
failure, is it? Seems like running in the embedded mode and
completely shutting down the database before using
it again would do the trick.

-Terry

Andrew White wrote:

>Terry Rosenbaum wrote:
>  
>
>>Speaking of my knowledge of the indexing system
>>and observations WRT 1.1b1:
>>
>>String Indexes with patterns like
>>"element", "element@id" and "*@id" should
>>work fine.
>>    
>>
>
>element@id doesn't.  See my comments on bug 21055.
>
>Unless I'm doing something else wrong?
>
>  
>


Re: xpath with index after data is added does not work

Posted by Andrew White <An...@motorola.com>.
Terry Rosenbaum wrote:
> 
> Speaking of my knowledge of the indexing system
> and observations WRT 1.1b1:
> 
> String Indexes with patterns like
> "element", "element@id" and "*@id" should
> work fine.

element@id doesn't.  See my comments on bug 21055.

Unless I'm doing something else wrong?

-- 
Andrew White                Andrew.E.White@motorola.com
  Research Engineer         +61 2 9666 0702
----------------------------------------------------------------------
Motorola Australian Research Centre (part of Motorola Labs)
  Sydney, Australia
  Locked Bag 5028           Internal: http://marc.labs.mot.com/
  Botany NSW 1455           External: http://www.motorola.com.au/marc/
  Australia                 +61 2 9666 0500 (reception)
MARC Research Implementation Team
    Internal: http://marc.labs.mot.com/public/rit/

Re: xpath with index after data is added does not work

Posted by Terry Rosenbaum <Te...@amicas.com>.
Speaking of my knowledge of the indexing system
and observations WRT 1.1b1:

String Indexes with patterns like
"element", "element@id" and "*@id" should
work fine.

I would not expect a pattern like "metatable/*/*@id" to work -
the only acceptable patterns are as shown above. There
is no hierarchical addressing in the indexing system.

Indexes are automatically updated as Resources are
added and/or removed.

When an index is created, the population of that index is
performed "in the background" by another thread. If there
are already Resources in the Collection, time must be allowed
for index population to complete before you will see the
performance impact of the index (if any).

The comparisons used to implement numeric indexing are
broken. So, an index defined with, e.g., type="long"
will not work properly. Indexes with type="string" work
as expected. But, comparing numbers as strings generally
will not yield the hoped-for result for non-equality comparison
operators (e.g. [@id>5] with a string index. See bug #19203 
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19203>. 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19203)

-Terry

matt ma wrote:

>What version are you using Andrew?  I'm using 1.1b1
>and noticed that if you add index with 
>-p *@id  
>and you have id attributes in multiple levels of your
>xml file you will end up with no results on xpath
>quering [@id=?].  However, I was able to get this to
>work by specifying the level
>metatable/*/*@id
>xpath with this index does return results but no
>significant performance gain so I'm wondering if it
>works at all.
>
>For the indexes that work I am seeing significant
>performance improvements (~3x) for my db.
>
>I'm trying to figure out if indexes by design do not
>update themselves like they do in a normal database or
>if this is a bug.
>
>-matt
>
>--- Andrew White <An...@motorola.com> wrote:
>  
>
>>Xpath with attribute indexes is (to the best of my
>>experimentation) broken.
>>I can't even get xindice to show results when I
>>delete and recreate the
>>index (works when deleted, putting it back breaks it
>>again).
>>
>>I also noticed that (when I first created the index)
>>I got about a 2x
>>performance gain on command line searches, but a
>>very slightly negative
>>effect on embedded searches.
>>
>>Anyone else?
>>
>>-- 
>>Andrew White
>>    
>>
>
>
>__________________________________
>Do you Yahoo!?
>Protect your identity with Yahoo! Mail AddressGuard
>http://antispam.yahoo.com/whatsnewfree
>  
>


Re: xpath with index after data is added does not work

Posted by matt ma <ma...@yahoo.com>.
What version are you using Andrew?  I'm using 1.1b1
and noticed that if you add index with 
-p *@id  
and you have id attributes in multiple levels of your
xml file you will end up with no results on xpath
quering [@id=?].  However, I was able to get this to
work by specifying the level
metatable/*/*@id
xpath with this index does return results but no
significant performance gain so I'm wondering if it
works at all.

For the indexes that work I am seeing significant
performance improvements (~3x) for my db.

I'm trying to figure out if indexes by design do not
update themselves like they do in a normal database or
if this is a bug.

-matt

--- Andrew White <An...@motorola.com> wrote:
> Xpath with attribute indexes is (to the best of my
> experimentation) broken.
> I can't even get xindice to show results when I
> delete and recreate the
> index (works when deleted, putting it back breaks it
> again).
> 
> I also noticed that (when I first created the index)
> I got about a 2x
> performance gain on command line searches, but a
> very slightly negative
> effect on embedded searches.
> 
> Anyone else?
> 
> -- 
> Andrew White


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

Re: xpath with index after data is added does not work

Posted by Andrew White <An...@motorola.com>.
Xpath with attribute indexes is (to the best of my experimentation) broken.
I can't even get xindice to show results when I delete and recreate the
index (works when deleted, putting it back breaks it again).

I also noticed that (when I first created the index) I got about a 2x
performance gain on command line searches, but a very slightly negative
effect on embedded searches.

Anyone else?

-- 
Andrew White