Using Lucene.Net_2_9_1/contrib/Spatial.Net with Umbraco - umbraco

I've tried doing this with Umbraco 6.1.6. I've pretty much implemented what Drew did here: http://our.umbraco.org/forum/developers/extending-umbraco/23200-Lucene-with-spatialnet?p=0
I'm storing lat and long data in umbraco nodes. The nodes are being indexed as encided values with tiers. But, I am not returning any results when I add the DistanceFilter to the query.
I'm just wondering if anyone else has tried this and got it working. Perhaps you can post some code.
Thanks.

Josh,
Have you inspected the index using luke just to ensure that fields are there? Also have you tried running raw queries (get the generated query written out using code) on the index using luke?
Regards
Ismail

Related

Using custom metadata in the result of OData queries

I wonder if it's possible to use custom metadata within the result of OData queries (at the entity level). I think of metadata such as scores since the query executed on an ElasticSearch database and I would like to provide these hints to the end user.
Thanks very much for your help!
Thierry
Sorry I'm not familiar with ElasticSearch. But if I understand your questions correctly, you want some information other than the raw data in the request result ? If so, there is such things called Instance Annotation that may satisfy your need. An explanation from OData spec.
HTH

Ruby on Rails: How to have multiple controllers for one table AND multiple models

I'm new to Ruby and to Rails. I have played a bit with Sinatra but I think that Rails is a more complete framework for my project. However, I am running into trouble with this.
I am working with an fairly substantial existing, and heavily used, mySQL database and I am trying to build an API for this that will report on certain features. The features that are needed are, for the most part, counts of records by certain groupings, then drilling down into details.
For example we have a table - tableA, that contains lots of information relating to documentation. One piece of information we want to report on from that is the number of items in a given language. The language code is stored against each item and based on a get request I would like to return JSON.
Request: /languages/:code/count/:tablename
There are two variables in that most specific URL - the code we are counting and the table we are counting from.
I understand that in routes.rb I can set up a mapping:
get '/languages/:code/count/:table', :controller=>'languages', :action=>'count'
I have a controller - languages_controller.rb with a count method in it. this then matches to a corresponding view file count.html.erb
In all the tutorials I have read and examples I have followed the main point seems that 'languages' would be a table in the database and would therefore be available under the 'magic' Rails approach.
My issue is that it is not a table, rather the results of the call should be a limited subset of the fields in tableA. Such as languagecode and count(id).
The description of the language needs to be looked up 'manually' as it is stored as an internal code that is not in a database anywhere (historic decision/madness).
The questions:
how do I have a model that is only a subset of fields, plus some that are manually populated - languagecode, isocode, description, count
Am I right in thinking that once I have the model defined as such as I could use ActiveRecord to get data from the database and then in the controller add the extra information in?
Can I change table in the model based on the parameter sent in the URL?
Essentially, I am at a loss at the moment on what to do with this. I have the routes defined, the view templates in place and the controller there and ready to go. The database component - getting some data from a pre-existing table seems mysterious to me.
Any help is greatly appreciated, it seems that the framework is currently getting in my way and I know that I can't be the only one trying this sort of thing so if you have any advice please share.
There's really no need for a model here, at all. This isn't what ORMs are for. What you should be doing is just running raw SQL against the database, and iterating over the results. Consider doing something like this: https://stackoverflow.com/a/14840547/229044

Rails to_s Mechanics

Hey guys this has been tripping me up quite a bit. So here is the general problem:
I am writing an application that requires users to enter their Summoner Names from league of legends. I do a pretty simple data scrape of a match and enter the data into my database. Unfortunately I am having some errors registering users with "special characters".
For this example I will use one problem user: RIÇK
As you can see RICK != RIÇK. So when I do the data scrub from the site I get the correct value which I push onto an array for later use.
Once I need the player names I pull from the array as follows: (player_names is the array)
#temp_player = User.find_by_username(player_names[i].to_s)
The problem is the users with any special characters are not being pulled. Should I not be using find_by? Is to_s changing my original values? I am really quite lost on what to do and would greatly appreciate any help / advice.
Thanks in advance,
Dan
I would like to thank Brian Kung for the link to the following: joelonsoftware.com/articles/Unicode.html It does a great job giving the bare minimum a programmer truly needs to understand.
For my particular issue I had used a HTML scraper to get the contents but which kept HTML entries throughout. When using these with my SQL lookups it was obvious that things were not being found. In order to fix this I used the HTMLEntities Gem to decode the text as follows (as soon as I put the into the array originally):
requires 'RubyGems' #without this cannot include htmlentries as a gem
requires 'HTMLEntries'
coder = HTMLEntries.new
line = '<'
player_names.push(coder.decode(line))
The Takeaway
When working with text and if running into errors I would strongly recommend tracing the strings you are working with to the origin and truly understanding what encoding is being used in each process. By doing this you can easily find where things are going wrong.

Neo4J: Querying a node index (with wildcards) via the webadmin Data Browser

Using a default index, one can do nodeIndex.get("message", "Hello") for exact matches, or nodeIndex.query("message", "Hel*") for approximate Lucene-based queries. This works correctly for me from Java.
But how do I do approximate queries through the webadmin Data Browser interface? Exact matches work fine, such as:
node:index:nodeIndex:message:"Hello"
but I can't see how to do the wildcard queries. The syntax is shown in the pop-up help panel as:
node:index:[index]:[query]
but I don't know what to put for the [query] part, and can't find any examples of this in the manual or the wiki. Have tried the following without success:
node:index:nodeIndex:"message:Hel*"
node:index:nodeIndex:message:"Hel*"
node:index:nodeIndex:"Hel*"
node:index:nodeIndex:Hel*
This should work:
node:index:nodeIndex:message:Hel*
The queryis message:Hel* so you just append it, more complex queries are also possible.
See the lucene syntax guide.
node:index:nodeIndex:message:Hel* OR message:Wor*
Issue created. https://github.com/neo4j/community/issues/138

confused how to use opentables in yql

i am trying to get access to whitepages using YQL. Unfortunately i don't have much experience with opentables.
I was directed to the whitepages xml file at:
http://github.com/spullara/yql-tables/blob/c63212b2ac9db6feb77ae3cecace51ed52e08c01/whitepages/whitepages.search.xml
Does anyone know how to use this table to extract meaningful information using YQL?
Specifically, I'm not sure how to make a query in YQL using this table to search for a person's name.
Help?
Go to the YQL console http://developer.yahoo.com/yql/console/ and click Show Community Tables. That should make the list on the right much bigger, and will include your table.
have you tried to put
&env=http%3A%2F%2Fdatatables.org%2Falltables.env
at the end of your request?

Resources