On Fri, Jan 21, 2011 at 05:54:52PM -0800, Andi Vajda wrote:
> 
> On Sat, 22 Jan 2011, Eric Hall wrote:
> 
> >On Wed, Jan 19, 2011 at 07:15:11PM -0800, Andi Vajda wrote:
> >>
> >>On Wed, 19 Jan 2011, Eric Hall wrote:
> >>
> >>>On Wed, Jan 19, 2011 at 11:05:28AM -0800, Andi Vajda wrote:
> >>>>
> >>>>On Wed, 19 Jan 2011, Eric Hall wrote:
> >>>>
> >>>
> >>>   Tha HashMap()... method works fine for storing the metadata, and luke
> >>>shows that its there.  Of course getting the metadata back for later
> >>>comparison/display is also useful, and seemed like it would be
> >>>straightforward....  Naturally its not working using:
> >>>
> >>>   indexMetaDataHashMap = reader.getCommitUserData()
> >>>
> >>>   I get an empty hashmap back from the above.  I also tried using:
> >
> >     Whups, I was wrong, I don't get a HashMap type back, I get
> >a 'Map' type back (still empty).  I don't know if that makes a difference
> >or not....
> 
> That shouldn't make a difference, that interface is wrapped too.
> To see what the actual Java class is for that map, you can call getClass() 
> on it. Maybe I'm missing something obvious here, how do you see that this 
> Map instance is empty ?

        I currently use:

        if (indexMetaDataHashMap.isEmpty()):
                ## the map is empty...
        else
                ## the map is not empty...

        I also tried getting the size() (is zero), and getting the
keySet() (the set/list I get back says its empty (isEmpty()), and
I get nothing when I iterate over it).
        Hopefully I'm doing all of those correctly of course.


> 
> >>>
> >>>   indexCommit = reader.getIndexCommit
> >>>   indexMetaDataHashMap = indexCommit.getUserData()
> >>>
> >>>with the same result (empty hashmap).  Is there a different way to do 
> >>>this?
> >>>
> >>
> >>If you're getting a HashMap back then the PyLucene side of things is
> >>working. If it's empty it could mean that you're doing something wrong
> >>Lucene-wise or that you found a bug there. Could it be that you opened the
> >>IndexReader before the IndexWriter got committed ? If so, reopen() it 
> >>after
> >>commit or move the opening code. If not, you may want to ask about this on
> >>the Lucene user list at java-u...@lucene.apache.org.
> >>
> >
> >     I definitely open the reader after the writer is committed and 
> >     closed,
> >they're separate scripts.
> 
> Maybe you're not using this API correctly ?
> http://lucene.apache.org/java/3_0_3/api/core/org/apache/lucene/index/IndexReader.html#getIndexCommit()
> Why aren't you calling reader.getCommitUserData() directly ? (the former is 
> labeled Expert and liable to change but I don't know either APIs)
> http://lucene.apache.org/java/3_0_3/api/core/org/apache/lucene/index/IndexReader.html#getCommitUserData()

        I am using reader.getCommitUserData(), I just tried using
the getIndexCommit() to see if it would work or not.

> 
> Did you ask about this on java-u...@lucene.apache.org ?

        I have not, that'll be the next thing, I wanted to check that
it should work in pylucene and I'm doing it correctly.

> 
> Of course, to help with narrowing down the bug, you could write the same 
> Java code directly and see if you encounter the same problem...

        Yup, and/or check the luke source since its able to show me the
information.


                        Thanks again,


                        -eric

Reply via email to