Re: Why SolrInputDocument use a LinkedHashMap

2013-02-14 Thread Andre Bois-Crettez

Almost. I did not benchmark it but tend to believe this
http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html :

iteration over the collection-views of a LinkedHashMap requires time
proportional to the /size/ of the map, regardless of its capacity.
Iteration over a HashMap is likely to be more expensive, requiring time
proportional to its /capacity/. 

André

On 02/13/2013 06:58 PM, knort wrote:

If the order is not important, using a HashMap offers the same fast
iteration on the fields but without having an extra LinkedList.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Why-SolrInputDocument-use-a-LinkedHashMap-tp4040195p4040260.html
Sent from the Solr - User mailing list archive at Nabble.com.


--
André Bois-Crettez

Search technology, Kelkoo
http://www.kelkoo.com/


Kelkoo SAS
Société par Actions Simplifiée
Au capital de € 4.168.964,30
Siège social : 8, rue du Sentier 75002 Paris
425 093 069 RCS Paris

Ce message et les pièces jointes sont confidentiels et établis à l'attention 
exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce 
message, merci de le détruire et d'en avertir l'expéditeur.


Why SolrInputDocument use a LinkedHashMap

2013-02-13 Thread knort
Programming some tests I found that two SolrInputDocuments with the same
fields and values are different.

Trying to figure it out why it's happening I found that the
SolrInputDocument class use a LinkedHashMap.

Is the insert order of the fields important for Solr?


Thank you



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Why-SolrInputDocument-use-a-LinkedHashMap-tp4040195.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Why SolrInputDocument use a LinkedHashMap

2013-02-13 Thread Andre Bois-Crettez

Maybe it is more about having fast iterations even on a large collection
of fields ?

André

On 02/13/2013 12:43 PM, knort wrote:

Programming some tests I found that two SolrInputDocuments with the same
fields and values are different.

Trying to figure it out why it's happening I found that the
SolrInputDocument class use a LinkedHashMap.

Is the insert order of the fields important for Solr?


Thank you



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Why-SolrInputDocument-use-a-LinkedHashMap-tp4040195.html
Sent from the Solr - User mailing list archive at Nabble.com.


--
André Bois-Crettez

Search technology, Kelkoo
http://www.kelkoo.com/


Kelkoo SAS
Société par Actions Simplifiée
Au capital de € 4.168.964,30
Siège social : 8, rue du Sentier 75002 Paris
425 093 069 RCS Paris

Ce message et les pièces jointes sont confidentiels et établis à l'attention 
exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce 
message, merci de le détruire et d'en avertir l'expéditeur.


Re: Why SolrInputDocument use a LinkedHashMap

2013-02-13 Thread Chris Hostetter

: Is the insert order of the fields important for Solr?

svn blame can frequently be useful for understanding why specific 
choices were made...

http://svn.apache.org/viewvc?view=revisionrevision=604951

https://issues.apache.org/jira/browse/SOLR-439

...nut shell: it may not matter to you what order the fields are in, but 
there are some usecases where other users can optimize things if the field 
order is garunteed, and it's relatively cheap to do so, so solr preserves 
the order.



-Hoss