Forums / Extensions / eZ Find / eZ 4.1 Object states and eZ Find?

eZ 4.1 Object states and eZ Find?

Author Message

Josh Bair

Friday 24 April 2009 6:33:55 pm

Are these not supported?

We have state groups and a limitation by state on content/read for anonymous users. When eZ Find encounters this, it outputs:

Debug: ezfeZPSolrQueryBuilder::policyLimitationFilterQuery unknown limitation type: StateGroup_foo_bar

but appears to break the policyLimitationFilterQuery with an empty "AND ( )" clause.

Solr then replies with:

"Encountered ")" at line 1, column 2653.
Was expecting one of:
    <NOT> ...
    "+" ...
    "-" ...
    "(" ...
    "*" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...
    
        at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:173)

I can see where the unknown limitation type error is hit in ezfezpsolrquerybuilder.php but I don't see how it's getting appended to the policy limitation filter.

Carlos Revillo

Saturday 25 April 2009 2:03:42 am

Hi.
I think this is not possible with the last stable version of ezfind, but i think that las commit to the trunk version is related to this. maybe you can check it.

Marco Caldari

Tuesday 08 September 2009 3:20:19 am

Hello,
With ezp 4.1.3 and ezfind 2.0, once Installed an object states functionality with different anonymous use access on objects with a certain 'state' ezfind stop working, maybe is the same issue noticed on this thread, did You fix it somehow?
Thanks for Your help,
Marco

Marco Caldari

Tuesday 06 October 2009 5:37:29 am

Issue fixed with ezfind 2.1, now it works!! Thank You

Jairo Riascos M.

Tuesday 11 May 2010 7:53:44 am

Hello,

I'm trying to use ezfind fetch to search content with a particular state, ezfind supports filter by state?
or the only way to hide/show objects in the search results is using user roles.

Thanks for your help.

Jairo Riascos

Paul Borgermans

Monday 17 May 2010 1:17:58 pm

Yes, objects states can be used in a filter

for example, to display those objects with states 2, 3 or 6

 ... filter, array('meta_object_states_s:(2 3 6)' ....

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Jairo Riascos M.

Tuesday 15 June 2010 1:54:30 pm

Thank you very much Paul, very helpful.

Jairo Riascos

Philipp Kamps

Wednesday 12 January 2011 5:54:46 am

Is there more documentation available? I try to filter for one object state like this:

filter, array('meta_object_states_s:( 8 )

But in my result set I get nodes back with these state IDs: 1, 7, 9. I'm surprised they match my filter.

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Gaetano Giunta

Wednesday 12 January 2011 9:36:53 am

@Philipp: try first using the same filtering sting in the solr admin console, then check in the eZFind debug output the exact query string sent to solr

Principal Consultant International Business
Member of the Community Project Board

Philipp Kamps

Thursday 13 January 2011 2:54:40 am

Hi Gaetano,

I'm running ezfind 2.1.

Here the code:

// Article: Who’s creating US jobs? Mexicans.
$ezobj = eZContentObject::fetch( 257166 );

var_dump( $ezobj->attribute( 'state_id_array') );

$search_result = eZFunctionHandler::execute( 'ezfind', 'search', array( 'query'   => 'Mexicans',
                                                                        'class_id' => array(  'csm_blog_post', 'csm_article', 'folder' ),
                                                                        'filter'  => array( 'meta_object_states_s:(8)' )
                                                                      ) );


foreach($search_result[ 'SearchResult' ] as $item )
{
    echo $item->attribute( 'name' ) . ':';
    
    print_r( $item->attribute( 'object')->attribute( 'state_id_array') );
}

Here the output:

array(3) {
  [1]=>
  string(1) "1"
  [2]=>
  string(1) "7"
  [3]=>
  string(1) "9"
}
A celebration of Mexican art:Array
(
    [1] => 1
    [2] => 3
    [3] => 8
)
Mexican street art with an edge:Array
(
    [1] => 1
    [2] => 3
    [3] => 8
)
Who’s creating US jobs? Mexicans.:Array
(
    [1] => 1
    [2] => 7
    [3] => 9
)

Solr query string:

 webapp=/solr path=/select params={hl.fragsize=100&hl.requireFieldMatch=false&enableElevation=true&sort=score+desc&indent=on&qf=attr_article_quote_t+attr_audio_caption_t+attr_authors_csm_staff_t+attr_authors_t+attr_body_t+attr_dateline_s+attr_description_t+attr_internal_tags_k+attr_kicker_t+attr_media_side_t+attr_name_s+attr_page_description_t+attr_page_keywords_s+attr_page_title_s+attr_page_url_name_s+attr_print_headline_s+attr_related_monitor_media_links_t+attr_short_description_t+attr_short_title_s+attr_sidebar_fact_t+attr_sidebar_info_box_t+attr_summary_t+attr_tags_k+attr_title_s+attr_video_caption_t+attr_video_credit_s+attr_web_sum_t+attr_why_it_matters_t+meta_name_t&hl.simple.pre=<b>&hl.fl=attr_article_quote_t+attr_audio_caption_t+attr_authors_csm_staff_t+attr_authors_t+attr_body_t+attr_dateline_s+attr_description_t+attr_internal_tags_k+attr_kicker_t+attr_media_side_t+attr_name_s+attr_page_description_t+attr_page_keywords_s+attr_page_title_s+attr_page_url_name_s+attr_print_headline_s+attr_related_monitor_media_links_t+attr_short_description_t+attr_short_title_s+attr_sidebar_fact_t+attr_sidebar_info_box_t+attr_summary_t+attr_tags_k+attr_title_s+attr_video_caption_t+attr_video_credit_s+attr_web_sum_t+attr_why_it_matters_t&wt=php&hl=true&version=2.2&rows=10&fl=meta_guid_s+meta_installation_id_s+meta_main_url_alias_s+meta_installation_url_s+meta_id_si+meta_main_node_id_si+meta_language_code_s+meta_name_t+score+meta_published_dt+meta_path_string_s&bq=meta_installation_id_s:995a6b3cce57c025906d52c256362268^1.5+meta_language_code_s:eng-US^1.2+meta_language_code_s:eng-GB^1.0&hl.snippets=2&start=0&q=Mexicans&forceElevation=false&hl.simple.post=</b>&qt=ezpublish&fq=(+(meta_installation_id_s:995a6b3cce57c025906d52c256362268+OR+meta_anon_access_b:true+)+AND+(+meta_language_code_s:eng-US+OR+meta_language_code_s:eng-GB+)+)+AND+meta_is_invisible_b:false&fq=meta_contentclass_id_si:67+OR+meta_contentclass_id_si:45+OR+meta_contentclass_id_si:1&fq=meta_language_code_s:eng-US&fq=meta_object_states_s:(8)}

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Philipp Kamps

Thursday 13 January 2011 2:56:45 am

I like the smiley in my PHP code.

The field "meta_object_states_s" has multiple string values in solr:

<str>1</str>
<str>3</str>
<str>8</str>

I'm not sure what the syntax is to match on of those "strings" (which are integers really).

Peter told me that there is a "meta_object_states_ms" field in ezfind 2.3.

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Gaetano Giunta

Thursday 13 January 2011 5:26:02 am

Can you try running by hand the sqme solr query, removing the parenthesis around the value 8?

As an alternative: are you sure your content is indexed correctly? As far as I know

<span>$item</span><span>-></span><span>attribute</span><span>(</span> <span>'object'</span><span>)</span><span>-></span><span>attribute</span><span>(</span> <span>'state_id_array'</span><span>)</span> <span>)</span>

will go fetch those values again in the eZP db, not show you the values that are present in Solr for that node...

Principal Consultant International Business
Member of the Community Project Board

Philipp Kamps

Thursday 13 January 2011 6:20:54 am

You found the issue. The solr index still has the old state values (1, 3, 8). The result set re-fetches the states from the DB and shows the correct values. So basically ez admin interface is not triggering a solr index refresh when changing the object state and only changes the DB values.

So in order to do a true search by object state I would need to fix the missing triggers when a user changes the object states (might even be reported as an issue already).

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada