I just hope indexing one extra field isn't gonna be performance issue later.
Ty for your replies. Erick Erickson wrote: > > then you'll need to index another field that records that intention, or > just "know" which fields are intended to be multiple. > > Best > Erick > > On Sat, Oct 25, 2008 at 4:12 AM, agatone <[EMAIL PROTECTED]> wrote: > >> >> Yeah but if it happens that for a certain document field1 has only one >> value >> and in that case I can't know it is intended as a multiple. in that case >> adds.size() would be == 1 and it would look as normal field. >> >> What i need is to mark that field is intended to be multiple no matter if >> it >> contains 1 value or 10. >> >> I need this because my serach results are passed as JSON to other >> consumers >> and i have to tell them what's the structure. >> >> >> Erick Erickson wrote: >> > >> > No, no, no... >> > >> > Say you have the following >> > Document doc = new Document() >> > doc.add("field1", "stuff", blah, blah) >> > doc.add("field1", "more stuff", blah, blah) >> > doc.add("field1", "stuff and nonsense", blah, blah) >> > IndexWriter.addDocument(doc) >> > >> > >> > >> > >> > Now, in your search code that document comes up as a hit and you have >> > Field[] adds = doc.getFields("field1"); >> > >> > >> > adds.size() should == 3 >> > >> > whenever adds.size() > 1, you can know it has multiple entries.... >> > >> > I wasn't suggesting that you ever add empty fields, and I don't think >> an >> > empty >> > add would even compile. >> > >> > Best >> > [EMAIL PROTECTED] >> > >> > >> > On Fri, Oct 24, 2008 at 3:38 PM, agatone <[EMAIL PROTECTED]> wrote: >> > > > -- View this message in context: http://www.nabble.com/Multiple-values-in-field-tp20152411p20195217.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]