Quote:
Originally Posted by s3000xl
Hmmm... doesn't sound nice! I want to do something equivalent to this Java example:
Code:
Document document = new Document();
document.add(new Field("contributor", "s3000xl", Field.Store.NO, Field.Index.TOKENIZED));
document.add(new Field("contributor", "kees", Field.Store.NO, Field.Index.TOKENIZED));
With this I can do a search for all documents with contributor "s3000xl".
|
Okay i think i get you, that is if you search on "kees" or "s3000xl" Lucene will return exactly the same document?
Well i'm just a user not a Zend Framework developer but i'm pretty sure this is not covered in the Zend_Search_Lucene api, but what you can do (which depends on your skills) is to make your own field type. Because Zend_Search_Lucene is really extenable you can make your own field type.
I did some research for you and i think with some modifications it is possible. When you add a field, the document object just adds an array element to the fields array. Then when you commit a document to the writer, it will send it thro Zend_Search_Lucene_Index_SegmentWriter_DocumentWri ter->addDocument() this function loops al fields and then calls his parent with $this->addField() which is the segmentWriter, there in the addField function the system does some checks if the field already exists, etc..
In the function Zend_Search_Lucene_Index_SegmentWriter_DocumentWri ter->addDocument() it also writes the field, to the index. If you/we know how this is binary done i think we can fix this
By the way isn't storing a "term vector" (vector of terms) not the solution you are looking for? Because i see this:
<?php
if ($field->storeTermVector) {
/**
* @todo term vector storing support
*/
throw new Zend_Search_Lucene_Exception('Store term vector functionality is not supported yet.');
}
?>
If feel it as a challenge maybe we can fix this together

but i'm not really familair with the binary structure of a Lucene index.
Succes!