Views Taxonomy Select Brothers Terms - drupal-7

I'm working with Drupal 7.
I have a view with a page display that takes a taxonomy term from the url as an argument.
mywebsite.com/my-view-page/xxx
where xxx is the taxonomy term.
Now I would like to put in this page a block where are listed the taxonomy terms that have the same parent of xxx.
For example, if this is my taxonomy:
aaa
- yyy
- xxx
- zzz
bbb
In the xxx page I would like a block containing;
yyy
xxx
zzz
Is there a way to do it?
thank you!

Add a 'block' display to your view and just create a contextual filter for it. Under the 'Contextual Filters' section of the view, select that you're going to provide a 'Taxonomy term: Parent term'.
Then, when you're setting it up, specify that if the filter isn't present, you want to 'Provide default value' and select the option of 'Taxonomy Term ID from URL', or, alternatively, select 'Raw value from URL' and set it to pick up the second path component (so select '2'), since that's where it seems you'll be specifying the term (I hope it's the term id though, since that's what it'll be looking for. If not, go with my first suggestion!!!!).
Does that work?

Related

Apache solr query api on how to search for a perfect match of a column values

In solr repo we have tags for a page like 1,2,3 and user tags will have 1,2,3,4
Hence if user tags contains all page tags then we want give user the access
Spring solr Code below
Criteria criteria = new Criteria (“page tags”).in(usertags.getags())
Above code looks for OR checks i.e either user has 1,2 or 3. However I am looking for perfect match of page tags 1,2,3. Is there anyway to achieve this.
thanks in advance
Spring solr Code below
Criteria criteria = new Criteria (“page tags”).in(usertags.getags())
Above code looks for OR checks i.e either user has 1,2 or 3. However I am looking for perfect match of page tags 1,2,3. Is there anyway to achieve this.

how to create a views tree with taxonomy term in drupal 7

I know the steps but am stuck because i don't the meaning of the terms which is used in below instructions.
Views Tree with Taxonomy Terms
Creating Taxonomy Terms
Create some Taxonomy terms with parent/child (hierarchical) relationships.
Creating the View
First, create a new term view using the fields row style / unformatted list of fields (it is important that the tree style not be chosen now). Then:
Add relationship for taxonomy term: parent term
Add field term id (do not use relationship) and exclude it from display
Add field term id with relationship, exclude from display
Add any fields you want to display, like term name, term description, etc...
Change style / format plugin to Tree (Adjacency model)
Set Main field to Term ID
Set Parent field to Term ID with parent relationship
I want to follow above steps, i have created the taxonomy term with
parent child relationships and then i create the view here i got
confuse becuase they mentioned **fields row style / unformatted list
of fields (it is important that the tree style not be chosen now).
Then:
**
Add relationship for taxonomy term: parent term
Add field term id (do not use relationship) and exclude it from display
Add field term id with relationship, exclude from display
Add any fields you want to display, like term name, term description, etc...
Change style / format plugin to Tree (Adjacency model)
Set Main field to Term ID
Set Parent field to Term ID with parent relationship
i dont know where is taxonomy term when i clickk on advance there is
no taxonomy term : parent term please help me to out of this
When you click on "advance" in the page detail of your view, you have the "Relationship" part : click on "Add" button and check "Taxonomy term: Parent term".
For the fields, you have a "Fields" part, also with an "Add" button.
It's pretty easy, everything is explained, it's a step by step instructions.

Getting facet name plus extra/meta info about a field in Solr

Solr returns each facet as a collection of name/count pairs (wrapped in a FacetField). In my faceted search app I would use these as follows.
Audi (2)
Honda (5)
Mitsubishi (6)
Mercedes Benz (8)
Now I would like to turn this into a list of links. I could create URLs like
http://www.example.com/category=Mercedes%20Benz
That would work, but I would much rather have
http://www.example.com/category=4
That is, I would like to use the database ID of the categories/brands instead of their names.
Can I somehow link fields in Solr, so that I can link the category name to the category ID and have them both returned from my query? Or should I use a multivalued field and store the category name and id together?
Your advice is most welcome :)
I have an idea. You can define a new field which joins category id and category name together. Just like express below.
1_Audi, 2_Honda, 3_Mitsubishi ,4_Mercedes Benz
Faceting on the new field will get result like this,
1_Audi(2)
2_Honda(3)
3_Mitsubishi(4)
4_Mercedes Benz(5)
You can split them laterly to get both category id and name. Name for disply while id for link.
You can check for Solr pivot as well which will return the Category Name and the Category Id as parent child facet hierarchy which in you case will always be one to one match.

Solr : How to implement this logic?

I have the following scenario. Suppose I have table a big table like this.
Id(unique) returnMe desc name value
1 user1 all those living in usa country USA
2. user2 all those like game game football
3. user1 my hobbies are hobby guitar
Now, how can I get results (returnMe) for following queries.
1. For all those users who live in usa AND like guitar
2. For all those users who live in usa OR like guitar.
Please donot modify query in anyway.
For my solConfig.xml 'desc' , 'name' , 'value' are searchable , indexable fields.
Thanks for any help.
Well I am editing this to explain my logic ..
Step 1: Break query on AND like (live in USA) AND (like guitar)
Step 2: Then select returnMes from first query and returnMes from second query.
Step 3: Take common returnMes, returned from first query and second query.
Is there any way Solr can do that. Can we do it through Solr "join" or not or some otherway ??
I do want to do that in my PHP , it would be massive overhead.
You are going to need to modify the query in some way. A simple step to parse the query and add parentheses to it, and possibly field names to search. You could reasonably easily transform those queries into something like:
(For all those users who live in usa) AND (like guitar)
(For all those users who live in usa) OR (like guitar)
or perhaps you can cut out "for all those users who" and have simply:
(live in usa) AND (like guitar)
(live in usa) OR (like guitar)
And set the query field to value. Of course, you could run into issues, if you had a document with value=users, or something of that nature, since it will search for each term present in the value field.
If you really want to be able to work with natural language, than you can take look at the OpenNLP project.

cakephp multiple pagination with same model but different condition

I have a category and products table. In view, I need to list the data in the following way
Category1 title
id product name price (in a table)
Pagination numbers (I will pass the category id here)
Category2 title
id product name price
Pagination numbers
etc
etc
How can I do the pagination for this ? On first pagination click, other paginations should not be changed. Categories are dynamic.
I don't think there is an easy direct cakephp way of doing this. But you can do it. You need is to customize the links so the pass on another variable identifying the parameter and then you have to parse it and do the pagination.
I google it and find the same solution but with a step by step tutorial :D
How to have multiple paginators
Here they use the model name to identify it but you will have to put something like model1, model2, etc so you identify which one is it, or simply numbers or words you need.

Resources