It makes sense. In fact overloaded implementations of this method (e.g. in
Project) use the same kind of comparison, just ignoring unneeded fields.

On Wed, Sep 24, 2014 at 5:21 AM, Dave Brondsema <[email protected]> wrote:

> Is the following a reasonable change to should_update_index, or am I
> missing
> anything?  I came across an issue where some of our extensions were
> setting a
> value on a User, so the User got marked as 'dirty' in ming and thus the
> ArtifactSessionExtension wanted to update the record in solr.  However, the
> value set on the User was already at that value, so there was no actual
> change.
>
> diff --git Allura/allura/lib/search.py Allura/allura/lib/search.py
> index 9c4a5f3..2ee9b82 100644
> --- Allura/allura/lib/search.py
> +++ Allura/allura/lib/search.py
> @@ -80,13 +80,13 @@
>      def should_update_index(self, old_doc, new_doc):
>          """Determines if solr index should be updated.
>
>          Values passed as old_doc and new_doc are original and modified
>          versions of same object, represented as dictionaries.
>          """
> -        return True
> +        return old_doc != new_doc
>
>
>
>
> --
> Dave Brondsema : [email protected]
> http://www.brondsema.net : personal
> http://www.splike.com : programming
>               <><
>

Reply via email to