ServiceStack pagination IHasRequestFilter explanation - pagination

I am trying to implement ServiceStack pagination and I would like to follow a pagination tutorial.
Just a quick question - What exactly is a filter in this context? I assume the filter is the part after the question mark "?"? And the attribute is the parameter? Such as Name in www.myapplication/model?Name=xyz
Thanks.

Related

Use Liferay 7.2 Elastisearch Custom Filter to exclude all Web Content Articles with specific tag

I'm attempting to exclude all Web Content Articles with tag "no-search" applied to them from appearing in search results. However, I'm having difficulty figuring out how to set up the Custom Filter widget for that.
Here's what I have:
Filter Field: tagNames (have also tried assetTagNames)
Filter Value: no-search
Filter Query Type: Exists (have tried everything in the list with no success)
Occur: must_not
The documentation isn't being terribly useful for this. I even tried other example filter parameters provided on this page and they didn't function as expected either. What parameters do I need to use to do this successfully?
Answering for myself, since I ended up reaching out to Liferay support for help with this, and so this is accessible to anyone searching for it in the future. Here's what they told me to use.
Filter Field: assetTagNames
Filter Value: no-search (or your own exclusion tag here)
Filter Query Type: Match
Occur: must_not

Customize search results and facets in Liferay 7.1

this is my first question, thanks in advance.
I am trying to customize the liferay results portlet and facets, with custom results. I need to filter the results once the search is launched, and remove the results that do not have layoutId :
with->
layoutIds = journalContentSearchLocalService.getLayoutIds(groupId,false,articleIdResult);
I´m doing this in a jsp fragment, but i think that it´s not correct.
I have been searching and i think the correct way is to modify the java class with the action, for example with acction coomand hook, is this correct?
Please, can you explain me the correct way to modify this functionalities?
Regards!!
ok. it looks you want result of journalarticle having display page is set. in that case, you need to look for JournalarticleModelPreFiltercontributor component extension or journalarticlepostprocessor if you are using legacy search api. when article gets indexed layoutuuid field is also indexed for each article. that field will have value if display page is set for specific web content or article.
So, you can use any of the above mentioned way to add check that this field should not be empty as search term. which will filter your result in request itself. instead adding overhead on result as later filtering in jsp.

How to order/sort my collections / relationships?

I've just started using Jhipster for a simple project with a very simple datamodel (so far).
I have a question regarding the generated code for the one-to-many relationship:
Is it possible to generate with List instead of a Set, so I can have my child-items ordered?
If no, what is the best solution to solve my problem? I see 2 ways:
Change the generated code manually to use a List and then use liquibase (mvn liquibase:diff) to update my database ?
Have an attribute on the child-item to handle the order ?
What is the best way to handle the "problem" ?
Best regards
Martin Elkkjær
You can use the Spring #OrderBy annotation to sort your sets by the child entity. See http://www.objectdb.com/api/java/jpa/OrderBy
#Entity
public class Person {
...
#OrderBy("zipcode.zip, zipcode.plusFour")
public Set<Address> getResidences() {...};
...
}
I'd also recommend the following blog that explains how Sets/Lists differ for Hibernate and JPA: https://vladmihalcea.com/hibernate-facts-favoring-sets-vs-bags/ (where I found the answer originally)

drupal search for a specific content type along with its node type for comments

I have a content type called 'ticket'; its Node type for comments is 'interaction'.
I want a search interface which searches through only these two (ticket,interaction) content-types; and output the node-link/title
Also, even though matches are found in interactions, i should be displaying the respective ticket node-link/title. (since interaction are actually the comments for the ticket node)
Can anybody please help me achieve this?
Thanks!
You should try using the Views module in conjunction with the core search module. You can create a view, filter the content type to ticket, and then add an exposed "Search: Search Terms" filter to your view.
Of course you could also write a quick custom module and do your own query.

how do I implement a kohana pagination in MVC?

that's it. How do I implement the Kohana pagination library in MVC way? which code should go to the model? to the controller? to the view? I have seen tons of examples but none of them are implemented in MVC.
Pagination has two parts: the records filter part which should go in the controller and the display part which goes into the view. The example in the pagination library help is correct.
If you want to implement your own pagination library take a look here.
To fulfill the MVC philosophy, you could:
1) have 2 methods in a model which make the same query but one returns only the row count and the other returns the actual result, being able to apply a LIMIT and an OFFSET.
Let's say, Some_Model::get_results() and Some_Model::get_result_count()
2) In your controller, when pagination is needed, you call Some_Model::get_result_count() to know the total quantity of rows, and pass that value to Kohana's pagination initialization, to get the pages links, which you put into a variable to pass to the view.
3) In the view, you echo the variable that has the pages links, and voila!
Of course this assumes you read the Kohana documentation for pagination and its examples.
Hope it helps.

Resources