Display of properties with SearchService

The SearchService delivers the values that are also displayed in the client service. Therefore you can also adapt and customise the CategoryDescriptor as described in section "Index an search properties".

But you can also request properties for the search with addRequestProperty.


QueryExpr query = QueryExpr.newBuilder().setKind(QueryExpr.Kind.EXPR_UNPARSED).setUnparsedExpr(userQuery).build();
SearchRequest searchRequest = SearchRequest.newBuilder()
	.setRankingStrategy(RankingStrategy.RANK)
	.setDetailLimit(DetailLimit.CONTENT)
	.setUserQuery(query)
	.addRequestedProperty(PropertyDefinition.newBuilder().setName("title"))
	.addView(View.newBuilder()
		.setId(View)
		.setCount(10)					.setRankingStrategy(mindbreeze.query.ViewProtos.View.RankingStrategy.RELEVANCE)
	)
.build();


You receive an identical value object to what you specified when indexing.

Instead of a simple Unparsed-QueryExpr you can also use a Labeled-QueryExpr. This allows you to define the name of the property separately to the search term.


QueryExpr query = QueryExpr.newBuilder()
.setKind(QueryExpr.Kind.EXPR_LABELED)
	.setNamedExpr(Labeled.newBuilder()
		.setLabel("name")
		.setExpr(QueryExpr.newBuilder()
			.setKind(QueryExpr.Kind.EXPR_UNPARSED)
			.setUnparsedExpr("value")
		)
	).build();


This can be useful if, for example, there is an entry field for a property. Then the property name is fixed and the user entry is used as the search term.