Skip to content

Instantly share code, notes, and snippets.

@wardbekker
Created September 9, 2011 06:31
Show Gist options
  • Save wardbekker/1205618 to your computer and use it in GitHub Desktop.
Save wardbekker/1205618 to your computer and use it in GitHub Desktop.
Add Attribute Tokens
add_attribute_tokens(Id, AttributeName, AttributeValue) ->
add_facet( Id, AttributeName, AttributeValue ),
Tokens = string:tokens(string:to_lower(AttributeValue), " ,.:;-"),
TokensAndPositions = lists:zip( Tokens, lists:seq( 1, length(Tokens))),
lists:foreach(
fun({Token, Position}) ->
keyword_ser:add_keyword_position( Token, Id, Position)
end,
TokensAndPositions
).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment