Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

No result ?

Trying to get a list of error message keywords used for indexing
The following runs, but it seems I have no result....


IQueryService queryService= (IQueryService)((IClientLibraryContext)repo).getServiceInterface(IQueryService.class);
WorkItemQueryModel model= WorkItemQueryModel.ROOT;
IDataQuery query= IDataQuery.FACTORY.newInstance(model);

aQuery = (IItemQuery)query.filter(model.internalTags()._ignoreCaseLike("CRJAZ%")).distinct();
ResultIterator i = new ResultIterator(queryService, aQuery, IQueryService.EMPTY_PARAMETERS);
while (i.hasNext()) {
IItemHandle item = i.next();
if (item != null) {
print(item.toString());
}
}


What is wrong in my query ? :) should I first filter on the type ?

0 votes



3 answers

Permanent link
Hi Chris,

There's some confusion between whether you're using an IItemQuery or an IDataQuery. You create a data query, but then cast to an item query when setting the filter. filter() and distinct() just return the receiver, so reassigning the query var is not needed. You should just create an item query to start with. I don't think that's the cause of the problem though, since the underlying implementation class is the same (which also explains why it's not failing with a CCE).

I think the issue is that the representation of the tags list on a work item is a specially formatted string. It separates the tags with '|', including a leading one.
e.g. if a work item had tags "foo" and "bar", then the internalTags field would be "|foo|bar|".

Try using _ignoreCaseLike("%|CRJAZ%|%").

0 votes


Permanent link
Thx Nick, seems it was it....
Now...ummm, if I understand well, I get a query of Work Item Handle...
How do I realize the 'filter' (i.e what string was match for that work item ) , do I have to realize the workItem ?

IQueryService queryService= (IQueryService)((IClientLibraryContext)repo).getServiceInterface(IQueryService.class);
WorkItemQueryModel model= WorkItemQueryModel.ROOT;
IItemQuery query= IItemQuery.FACTORY.newInstance(model);
query.filter(model.internalTags()._ignoreCaseLike("%|CRJAZ%|%")).distinct();

ResultIterator i = new ResultIterator(queryService, query, IQueryService.EMPTY_PARAMETERS);
while (i.hasNext()) {
IItemHandle item = i.next();
if (item != null) {
print(item.toString());
}
}

0 votes


Permanent link
Yes, for an item query, you just get back item handles, for the items that matched.
You therefore need to read the item (using IRepositoryItemService.fetch*).

If all you're interested in doing is collecting the tags, it would be more efficient to use a data query. It may also be easier to use the IServerQueryService instead of IQueryService, as the former doesn't require paging (and the query can't get flushed from the cache while iterating like with regular queries).

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,952

Question asked: Oct 24 '11, 11:00 a.m.

Question was seen: 4,963 times

Last updated: Oct 24 '11, 11:00 a.m.

Confirmation Cancel Confirm