I have a taxonomy vocab assigned to a content type in Drupal 6. I've then exposed (using "is one of") it as a field in views which allows a user to search via keywords.
The problem is when it runs the query it is first referencing the term so instead of using a like statement it looks the term up in the taxonomy table and brings back it's ID. So if a user searched for one term that exists and another that doesn't the whole thing fails rather than bringing back relevant results for the first term that exists.
Is there anyway to do partial matching using views?
Thanks
For anyone looking for the answer the best implementation I could find was Apache Solr.
Relatively easy to setup if you have your own server.
More information can be found here - http://drupal.org/project/apachesolr
Related
I am having a curious problem in Drupal 7, related to Taxonomy translation.
I am using a taxonomy vocabulary whose terms are localized. In order to differ taxonomy terms from one another (so the term names can all have different names), I am using an extra field called "Display Name". Since I have to show the names of the taxonomy terms and some of them have the same name (and I already had problems with that), I opted for using this extra field. And I found out that I can enable translation for this field only, through an option named "Enable Translation" in field settings.
Then, I have translated these terms using this option named "Enable Translation". I found that it is a batch operation that is activated when you enable it, allowing you to set up translated terms via the interface provided by Taxonomy.
However, after updating the website, I found out that my terms using this "Display Name" field disappeared. And I can't seem to find the problem... It doesn't seem like something is missing in my feature but, since it is a batch operation, it will only be effective in the environment this batch is executed, right?
Maybe this already happened to someone else but, after a thorough research, I have found no valuable information about it. I appreciate any help you may provide!
I would like to create a data entry form in Drupal 7 that is similar to Filemaker's List View. List View is a view that contains many records on a page. When Submit button is clicked, data entered in the fields will be assigned to the individual records.
For example, I have a list of students' names and a column field of grade type. The student's name will be created from Drupal View's filtering, but the grade field will be empty waiting for me to key in.
What is the proper Drupal's module that can enable this functionality? Or what can I do to create this functionality.
This approach is closer to your original request, im testing this out now and I think it should more than do the trick, much more interestingly too.
http://drupal.org/project/slickgrid
Edit:
I highly recommend trying this its awesome!!
A couple quick tips
Be sure to also install http://drupal.org/project/title so you can reset the title (make it a field), Basically with this editor you can only edit actual fields, so same goes for location module, you'll need to use the field option rather than node option.
One possible downer, at least for my site, it appears the drupal module does not support jquery 1.7 which my site uses, so a few buttons etc don't work as expected, also the drupal module does not support the latest slickgrid release either. I'd like to look into fixing that but I dont have the time just yet, possibly someone will before long. If jquery 1.7 is not required for your site then none of that will be a problem for you.
I just figured how to do something similar, although I went about it a different way then I think would be the most desirable, at any rate what I did works perfectly for me at the moment.
What I did...
Used a google docs spreadsheet for data entry, exported a CSV file, then used Feeds module to Import and Map it to my desired content type. I was even able to get location, taxonomy & image fields to map.
Modules & Stuff Used...
Feeds http://drupal.org/project/feeds which also includes Feeds
Importer, you'll want to read through all the instructions to be sure
you understand the import methodology, I could never explain it all
here!
Feeds Tamper http://drupal.org/project/feeds_tamper , I used this to
explode the cell which had a | separated | list of taxonomy terms (dont use comma), the
nice side effect is if the term doesn't exist it creates it for you!
Spreadsheet - Personally I created a Google Docs Spreadsheet, any type
will do. This spreadsheet has every field you want to map to fields
in your content type.
"More Better"
Currently I am on the hunt for a simple backend UI way to do this, but this is what I've settled on for now. I just couldn't imagine hand entering hundreds of nodes, page submit after page submit! I will post back if I figure another way to do it. Good luck!
I have just started with
https://www.drupal.org/project/editableviews
which enables the creation of views where all the fields are editable, including when no data exists in the related entity. At the first url is also documentation.
There a screencast which shows more
https://www.youtube.com/watch?v=g_D4z4Bw6iw
I am looking for a way to control access to a node (my own content type), even when it has the "published" bit set. I have a custom field (datetime) that specifies when the node should be available to visitors. How do I hook in to Drupal 7 to do that?
Best regards, Egil.
Have a look on node_access(), you should be able to do what you need there.
I accomplished a similar thing using hook_node_access_records() and hook_node_grants(). My example is for a field within a node that restricts access on a group level, but the same concept works (more easily) for non-group content.
The description of what I did is here: https://drupal.stackexchange.com/questions/36269/how-to-restrict-node-access-to-nodes-based-on-field-value/83975#83975
However, it might be easier for you to follow Node Access Example Module: https://api.drupal.org/api/examples/node_access_example!node_access_example.module/7
That is exactly what I modified to get my code.
I'm in a situation where I think I need to create my own custom search module. What I'm trying to do is make a page with a list of all my nodes in the node type - let's call it 'Beer'. So I want to be able to filter through the beers in a fashion similar to the one you find on the Apple Trailers page ( http://trailers.apple.com/ ).
I tried using Views 2 but ran it to a few problems:
I can't make the filter links like in the top of the trailers page (exclusive, just HD etc.)
The search function will only search one field (Exposed field "Beer title" but I also want it to search for manufacturer and other things.
I'm aware of a couple of solutions:
I could fix the last problem by using the Computed Field Module where I could combine the fields I want to search through. I just don't see this as a very elegant solution.
I could make my own module and create my own database queries where I apply the relevant filters (I just don't know how).
I could somehow use my already installed Solr module.
So the first solution - the easiest I guess but also kind of bad with duplicate content in my database.
The second solution - the best (maybe) - problem: I'm too dumb.
The third solution - Solr seems pretty cool but would I be able to present my beer nodes with just the title and a picture?
So I guess my question is. Which one of the three would you use? Or what other solutions could I potentially use (I'm confident there are things I haven't thought of :))?
Sounds like this could be a good use for Taxonomy not different node types. Also, Have you considered http://drupal.org/project/quicktabs ?
You could set up each "filter" as a tab that passes an argument down to a view. Then don't expose any views filters to the user.
I am trying to get a list of distinct taxonomy terms in drupal using views2.
It seems it shouldnt be that big of a problem, however when i select the taxonomy:all terms, and select what vocabulary to limit to i get duplicates.
The "distinct" option in drupal does nothing, and i cant find anything else that groups it together.
If anyone knows anything that would be great.
Thank you.
/Anders
In case of taxonomy terms, views2 applies the distinct clause to the term id, which is rather useless in your case. So afaik there is no way to do what you want in views2 without manipulating the view via custom coding.
So you might want to take a look into hook_views_query_alter() for an option to manipulate the query used by the view. Alternatively, you could execute the view via code and filter the resultset found in $view->result after execution of the view.
But depending on what you need the list for, those methods might be a bit overkill compared to just ignoring the views module for this task and doing the query directly in code from a custom module.
The problem you have having is what you actually are doing is to get all the taxonomies that match on every node on your site. A quick hack would be to create a node (doesn't need to actually be published) that contains all of the taxonomy terms, then you could limit the nodes to only that node and you would get a list of all taxonomy terms you want.
Else I would go for one of the options that Henrik Opel suggested, personally I would just make a little custom module for this, and make the queries myself.
Views is a very powerful module, but in some cases, it's actually a lot easier and faster to just do the queries yourself. Especially when the display is not so complicated. You could even use the templates that views has to render your data, if you don't want/need to create your own.