New Property for Simple Publish portlet

Hi Alex,

Do you have any examples for this?

I tried the following code for getContentSource

IContext context = ContextFactory.acquireContext(true);
IBizPolicyManager bizPolicyManager = (IBizPolicyManager) PortalSystem.getBizPolicyProvider();
IContainerPolicy containerPolicy = (IContainerPolicy) bizPolicyManager.getBizPolicy(arg0);
return containerPolicy.getContent(context,arg0,null);

and returned true for the match method.

After this, I tried publishing a document with this DBO and searched a value which I had entered in the custom property for that DBO; it did not return any search results.

Thanks

You are missing just one more step. You do not need to return IContentSource for file object, its content is already indexed. You need to create your own implementation of IContentSource and populate its input stream with space separated values of your additional properties you would like to be indexed.

I don’t think the DBO should need a custom content source. The extended attributes of a DBO are already indexed by default, so you should be able to just search on the existing field in the search index.

Yes, the last post is correct I take my words back that DBO attributes are not in the index

Please clarify about extended attributes; I have created properties under a new property group in “Property Groups” in Eclipse IDE. Do they fall under extended attributes?

If this is so, I have done it and still these fields are not being searched for the keywords

Since the fields are not getting indexed by default, can you tell me how to get an implementation of IContentSource so that I can populate its input stream with the space separated fields.

This method will index the fields, correct?

Thanks

The fields are getting indexed, but the fields included in the search query depend on which search portlet you are using to initiate the search. The out-of-the box basic search portlet searches only the name,description and file content fields.

Since you are wanting to search on one of the other fields, you would need to either use the advanced search portlet or clone the basic search portlet and change it to search the other fields.

You can verify that the fields are searchable by using the Advanced search portlet with the following procedure:

  1. Navigate to the Advanced search portlet.
  2. Fill in the ‘Extended Type’ field with your DBO type.
  3. Then for the ‘Extended Attibutes’ section, select the DBO property/value to search for.
  4. Do the search.

HI Enorman,
As a matter of fact, we have our own search portlet. Can you provide us sample code as to where to add these custom fields so that they too will be searchable.

The other option of selecting Extended type etc… is not feasible from an end-users point of view.

Thanks

When the search form is posted to the search command on the server any form field whose name has the field_ prefix are treated as a query on that field of the search index. All the properties of a portlet or DBO are in the search index in a field with the same name as the property name.

So, your extended attributes can be handled the same way as the name/description fields in the portlet that you have cloned.

Your customizations would need to do something like this:

  1. In your search form, add a new hidden field for each field you want to search on. Use ‘field_[dboPropName]’ as the name of the input field.

For example:
ui:propertyEditor
<util:param name=“type” value=“hidden” />
<util:param name=“name” value=“field_yourPropNameHere” />
<util:param name=“value”></util:param>
</ui:propertyEditor>

  1. Then change the form onSubmit handler logic to copy the value from the visible query field to the hidden field above. If you have cloned the wm_basicsearch portlet, then this change would go in the ui/search.js file of the portlet:

For example:

form.field_yourPropNameHere.value=elSearchFor.value;

I tried this and it is currently not working. I did note one thing though - in the URL, for field_name and field_description the value i enter comes; but for my custom field_searchTerms there is no value - …&wmp4161.fi;ield_searchTerms=&wmp4161.li;ibraries=portalStorageLibrary…

Did I miss anything?

Thanks

Any other updates on this? or should I contact Tech Support?

Thanks

Could you please post the entire JSP code of your custom search page for us to take a look

Alex

Hi Alex,

I have mailed the code to you.

searchTerms is the name of my field in the custom DBO I created.

Hmm, that seems like a client side problem. Could you please try to:

  1. Ensure that old version of the portlet’s script.js file is not cached by the browser?
  2. Are there any script errors during the form submit?
  3. Use the firebug script debugger to step through the onSubmit logic one line at a time.

It is likely that along there you should be identify why the submitted value is not getting into request url

Alex