Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-23-2007, 06:15 PM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Question Zend_Search_Lucene multi-value fields

How do I create/access multi-value fields? In the Java version I can add multiple values for the same field but the Zend version doesn't seem to be processing this properly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-24-2007, 10:31 AM
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default

Quote:
Originally Posted by s3000xl View Post
How do I create/access multi-value fields? In the Java version I can add multiple values for the same field but the Zend version doesn't seem to be processing this properly.
Hi,

I think there is no direct solution for your question. I think you want to save values in a set like MySQL (SET datatype)

What you could do is to binary index your data. This causes it's only stored and not searchable, but it is accesable.

<?
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('mul tiplefield',serialize($yourarray));
?>

Is an example
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-24-2007, 10:41 AM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Default

Quote:
Originally Posted by kees View Post
What you could do is to binary index your data. This causes it's only stored and not searchable, but it is accesable.

<?
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('mul tiplefield',serialize($yourarray));
?>

Is an example
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".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-24-2007, 12:38 PM
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default

Quote:
Originally Posted by s3000xl View Post
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-24-2007, 12:41 PM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Default

This is certainly worth a bash although I'm not sure how the framework will read these values when performing a search. Any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-24-2007, 12:49 PM
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default

Well then in my case you also have to extend / modify the search part..

I don't think this is a solution which is done in some hours...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-24-2007, 12:53 PM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Default

Indeed... more tweeking. Was hoping this would be possible just with the framework as it is. Maybe some Zend framework developers have some ideas too. I'd really like to use the php version of Lucene, but without this feature I may have to look back at the Java one and find a was to bridge to PHP.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-30-2007, 09:09 AM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Default

Any Zend Framework developers out there who could comment on this before I start hacking code around?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-19-2007, 06:54 AM
Junior Member
 
Join Date: Nov 2007
Posts: 1
Default

Is anyone working on this? I would need this feature too, maybe I'm able to help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-04-2008, 12:52 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default

Hello,
My search works fine, but i want to get both values of "contributor" out of the result-document. But (in this example) i get only "kees".
Are there any news about this problem?

Last edited by rahy : 03-04-2008 at 01:39 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:08 AM.