cancel
Showing results for 
Search instead for 
Did you mean: 

Tricky query for TREX

Former Member
0 Kudos

Hi,

I would like to query TREX for documents that has displaynames starting with a specific letter.

If I have three documents named Apple, Ananas and Different Apples I would like to find the two first when searching for documents having a displayname starting with A.

I have tried a couple of different techniques without any success.

Examples of such queries are:

displayname=a* AND NOT displayname=?a*

displayname=a* AND NOT displayname=a

The thing is I always ends up with all three or none of the documents.

I am writing my own component so I am pretty free when it comes to what I send to TREX.

Is anyone having some nice ideas on this problem?

Thanks,

Pierre

Accepted Solutions (0)

Answers (1)

Answers (1)

thilo_brandt
Employee
Employee
0 Kudos

Hi Prierre,

if you are on EP6 SP2 Patch 5 or NW04 SPS4 or higher, try the following:

IQueryEntry queryEntry = this.fedSearch.getNewQueryEntry();

queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);

queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);

queryEntry.setPropertyName(AbstractIndex.getDisplayNameAsStringPropName());

queryEntry.setValue("a*");

queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);

IQueryEntryList queryEntries = ...

queryEntries.add(queryEntry);

This should return all documents with displayname starts with a.

Best regards,

Thilo

Former Member
0 Kudos

Hi Thilo,

Thanks for the answer.

I am however developing for a Patch 4 portal and I have not been able to get the wanted behaviour with the attached code.

I have created an alternative solution to the problem that creates a rather large query - it works but it is not that nice.

If anyone is interested in this, just let me know.

Cheers,

Pierre

thilo_brandt
Employee
Employee
0 Kudos

Hi Pierre,

I would be interested in that query. Since my solution is only possible on Patch 5 and higher ...

Thilo